
export default {
  randomNumbers: function(length){
    return Array.from(new Array(length), function(){
      return Math.random();
    })
  },

  getBrowserType: function(){
    var sys={};
    var ua = navigator.userAgent.toLowerCase();
    var s;
    (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
      (s = ua.match(/firefox\/([\d.]+)/)) ? sys.firefox = s[1] :
        (s = ua.match(/chrome\/([\d.]+)/)) ? sys.chrome = s[1] :
          (s = ua.match(/opera.([\d.]+)/)) ? sys.opera = s[1] :
            (s = ua.match(/version\/([\d.]+).*safari/)) ? sys.safari = s[1] : 0;
    return sys;
  },
  getDeviceType: function(){
    function detectmob() {
      return navigator.userAgent.match(/Android/i)?"android":
              navigator.userAgent.match(/webOS/i)?"webOS":
              navigator.userAgent.match(/iPhone/i)?"iPhone":
              navigator.userAgent.match(/iPad/i)?"iPad":
              navigator.userAgent.match(/iPod/i)?"iPod":
              navigator.userAgent.match(/BlackBerry/i)?"blackBerry":
              navigator.userAgent.match(/Windows Phone/i)?"winPhone":"";
    }
    let device = detectmob();
    return device==""?device:"pc";
  },

  getWindowHeight: function(browser){
    if(browser.ie)
      return document.documentElement.clientHeight;
    else
      return window.innerHeight;
  },
  getWindowWidth: function(browser){
    if(browser.ie)
      return document.documentElement.clientWidth
    else
      return window.innerWidth;
  }
}
